<style>
    .layui-form-radio {
        margin: 0px !important;
        padding-right: 10px !important;
    }
</style>
<fieldset class="layui-elem-field layui-field-title">
    <legend>基本信息</legend>
</fieldset>
<form class="layui-form" action="">
    <table class="layui-table">
        <tr>
            <th rowspan="10">基本情况</th>
            <th>
                姓名
            </th>
            <th>{$admin.nickname ?? ''}</th>
            <th>
                性别
            </th>
            <th>
                {if $admin.archives.sex eq 0}
                <input type="radio" name="sex" value="0" title="男" checked>
                <input type="radio" name="sex" value="1" title="女">
                {elseif $admin.archives.sex eq 1 /}
                <input type="radio" name="sex" value="0" title="男">
                <input type="radio" name="sex" value="1" title="女" checked>
                {else /}
                <input type="radio" name="sex" value="0" title="男">
                <input type="radio" name="sex" value="1" title="女">
                {/if}
            </th>
            <th>民族</th>
            <th>
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="nation" value="{$admin.archives.nation ?? ''}" autocomplete="off"
                           class="layui-input">
                </div>
            </th>
            <th style="text-align: center;" colspan="2" rowspan="3">
                <img src="{$admin.portrait}"
                     onerror="this.src='/static/layuiadmin/style/res/template/character.jpg'">
            </th>
        </tr>
        <tr>
            <th>出生日期</th>
            <th>
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="birthday" value="{$admin.birthday ?? ''}" autocomplete="off"
                           class="layui-input">
                </div>
            </th>
            <th>婚姻状况</th>
            <th colspan="3">
                {if $admin.archives.marriage eq 0}
                <input type="radio" name="marriage" value="0" title="未婚" checked>
                <input type="radio" name="marriage" value="1" title="已婚">
                {elseif $admin.archives.marriage eq 1 /}
                <input type="radio" name="marriage" value="0" title="未婚">
                <input type="radio" name="marriage" value="1" title="已婚" checked>
                {else /}
                <input type="radio" name="marriage" value="0" title="未婚">
                <input type="radio" name="marriage" value="1" title="已婚">
                {/if}

            </th>
        </tr>
        <tr>
            <th>政治面貌</th>
            <td colspan="3"> {if $admin.archives.politics eq 0}
                <input type="radio" name="politics" value="1" title="党员">
                <input type="radio" name="politics" value="0" title="群众" checked>
                {elseif $admin.archives.politics eq 1 /}
                <input type="radio" name="politics" value="1" title="党员" checked>
                <input type="radio" name="politics" value="0" title="群众">
                {else /}
                <input type="radio" name="politics" value="1" title="党员">
                <input type="radio" name="politics" value="0" title="群众">
                {/if}
            </td>
            <th>毕业时间</th>
            <td>
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="graduation" value="{$admin.archives.graduation ?? ''}"
                           class="layui-input starttime">
                </div>
            </td>

        </tr>
        <tr>
            <th>身份证号</th>
            <th colspan="3">
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="id_card" value="{$admin.archives.id_card ?? ''}" autocomplete="off"
                           class="layui-input">
                </div>
            </th>
            <th>毕业学校</th>
            <td colspan="3">
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="school" autocomplete="off" value="{$admin.archives.school ?? ''}"
                           class="layui-input">
                </div>
            </td>
        </tr>
        <tr>

            <th>学历</th>
            <td colspan="3">
                {if $admin.archives.education eq 0}
                <input type="radio" name="education" value="3" title="本科以上">
                <input type="radio" name="education" value="2" title="本科">
                <input type="radio" name="education" value="1" title="大专">
                <input type="radio" name="education" value="0" title="以上都不是" checked>
                {elseif $admin.archives.education eq 1 /}
                <input type="radio" name="education" value="3" title="本科以上">
                <input type="radio" name="education" value="2" title="本科">
                <input type="radio" name="education" value="1" title="大专" checked>
                <input type="radio" name="education" value="0" title="以上都不是">
                {elseif $admin.archives.education eq 2 /}
                <input type="radio" name="education" value="3" title="本科以上">
                <input type="radio" name="education" value="2" title="本科" checked>
                <input type="radio" name="education" value="1" title="大专">
                <input type="radio" name="education" value="0" title="以上都不是">
                {elseif $admin.archives.education eq 3 /}
                <input type="radio" name="education" value="3" title="本科以上" checked>
                <input type="radio" name="education" value="2" title="本科">
                <input type="radio" name="education" value="1" title="大专">
                <input type="radio" name="education" value="0" title="以上都不是">
                {else /}
                <input type="radio" name="education" value="3" title="本科以上">
                <input type="radio" name="education" value="2" title="本科">
                <input type="radio" name="education" value="1" title="大专">
                <input type="radio" name="education" value="0" title="以上都不是">
                {/if}

            </td>
            <th>专业</th>
            <th colspan="3">
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="specialized_subject" value="{$admin.archives.specialized_subject ?? ''}"
                           autocomplete="off" class="layui-input">
                </div>
            </th>
        </tr>

        <tr>
            <th>参加工作时间</th>
            <th>
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="work_time" value="{$admin.archives.work_time ?? ''}" autocomplete="off"
                           class="layui-input starttime">
                </div>
            </th>
            <th>户口所在地</th>
            <th colspan="5">
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="registered" value="{$admin.archives.registered ?? ''}" autocomplete="off"
                           class="layui-input">
                </div>
            </th>
        </tr>
        <tr>
            <th>籍贯</th>
            <th>
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="native_place" value="{$admin.archives.native_place ?? ''}"
                           autocomplete="off" class="layui-input">
                </div>
            </th>
            <th>电话</th>
            <th>
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="tel" name="telephone" value="{$admin.archives.telephone ?? ''}" utocomplete="off"
                           class="layui-input">
                </div>
            </th>
            <th>地址</th>
            <th colspan="3">
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="address" value="{$admin.archives.address ?? ''}" autocomplete="off"
                           class="layui-input">
                </div>
            </th>
        </tr>
        <tr>

            <th>手机</th>
            <th colspan="3">
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="mobile" value="{$admin.mobile ?? ''}" autocomplete="off"
                           class="layui-input">
                </div>
            </th>
            <th>邮箱</th>
            <th colspan="3">
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="email" value="{$admin.email ?? ''}" autocomplete="off" class="layui-input">
                </div>
            </th>

        </tr>
        <tr>
            <th>紧急联系人</th>
            <th colspan="3">
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="emergency_contact" value="{$admin.archives.emergency_contact ?? ''}"
                           autocomplete="off" class="layui-input">
                </div>
            </th>
            <th>紧急联系人号码</th>
            <th colspan="3">
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="emergency_contact_phone"
                           value="{$admin.archives.emergency_contact_phone ?? ''}" autocomplete="off"
                           class="layui-input">
                </div>
            </th>

        </tr>
        <tr>
            <th>备注</th>
            <th colspan="7">
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <textarea placeholder="请输入内容" name="basic_remark" value="{$admin.archives.basic_remark ?? ''}"
                              class="layui-textarea"></textarea>
                </div>
            </th>
        </tr>
        <tr>
            <th rowspan="3">入司情况</th>
            <th>
                所属部门
            </th>
            <th>
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                        <select name="department_id" lay-search="">
                            <option value="">请选择...</option>
                            {foreach $group as $key=>$vo}
                            <option value="{$vo.id}" {if condition="($admin.archives.department_id eq $vo.id)"}selected{/if}>{$vo.name}</option>
                            {/foreach}
                        </select>
                    </div>
                </div>
            </th>
            <th>
                职务
            </th>
            <th>
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="position" value="{$admin.archives.position ?? ''}" class="layui-input">
                </div>
            </th>
            <th>入司时间</th>
            <th>
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="entry_time" value="{$admin.archives.entry_time ?? ''}"
                           class="layui-input starttime">
                </div>
            </th>
            <th>转正时间</th>
            <th>
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="formal_time" value="{$admin.archives.formal_time ?? ''}"
                           class="layui-input starttime">
                </div>
            </th>
        </tr>
        <tr>
            <th>
                合同到期时间
            </th>
            <th>
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="contract_expiration_time"
                           value="{$admin.archives.contract_expiration_time ?? ''}" class="layui-input starttime">
                </div>
            </th>
            <th>
                续签时间
            </th>
            <th>
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="renewal_time" value="{$admin.archives.renewal_time ?? ''}"
                           class="layui-input starttime">
                </div>
            </th>
            <th>聘用形式</th>
            <th colspan="3">
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <input type="text" name="employ" value="{$admin.archives.employ ?? ''}" class="layui-input">
                </div>
            </th>

        </tr>
        <tr>
            <th>备注</th>
            <th colspan="7">
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <textarea placeholder="请输入内容" name="company_remark" value="{$admin.archives.company_remark ?? ''}"
                              class="layui-textarea"></textarea>
                </div>
            </th>
        </tr>
        <tr>
            <th rowspan="5">档案所含资料</th>
            {foreach $archive_type as $key=>$vo}
            <th>
                <input type="hidden" name="type_id[]" value="{$vo.id}" class="layui-input">
                {$vo.name}
            </th>
            <th colspan="2" id="btn">
                <button type="button" class="layui-btn layui-btn-sm" name="{$vo.id}" id="upload{$vo.id}">上传</button>
                {if $admin.new_arr neq ""}
                {present name="admin.new_arr"}
                {foreach $admin.new_arr as $k=>$v}
                {if $vo.id eq $v.type_id}
                <input type="hidden" name="pic_imgs[{$key}]" id="path_url{$key}" value="{$v.path ?? ''}"
                       class="layui-input">
                {/if}
                {/foreach}
                {/present}
                {else /}
                <input type="hidden" name="pic_imgs[{$key}]" id="path_url{$key}" class="layui-input">
                {/if}
            </th>
            <th colspan="2">
                <div id="demo{$vo.id}">
                    {present name="admin.new_arr"}
                    {foreach $admin.new_arr as $k=>$v}
                    {if $vo.id eq $v.type_id}
                    <div class="layui-upload-list" id="layui-upload-list-id">
                        <div id="layer-photos-demo{$k}" data-id="layer-photos-demo{$k}" class="layer-photos-demo">
                            {foreach $v.path_arr as $ke=>$v1}

                            <img src="/storage/{$v1}" layer-src="/storage/{$v1}" class="layui-upload-img"
                                 style="width:40px;height:40px">
                            {/foreach}
                        </div>
                    </div>
                    {/if}
                    {/foreach}
                    {/present}
                </div>
            </th>
            <th colspan="4" id="dow">
                <button type="button" id="{$vo.id}" class="layui-btn layui-btn-sm dow">下载</button>
            </th>
        <tr>
            {/foreach}
        </tr>
        <tr>
            <th>备注</th>
            <th colspan="8">
                <div class="layui-input-inline layui-col-xs4 layui-col-sm6 layui-col-md12">
                    <textarea placeholder="请输入内容" name="remark" value="{$admin.archives.remark ?? ''}"
                              class="layui-textarea"></textarea>
                </div>
            </th>
        </tr>
    </table>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认">
    </div>
</form>

<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table', 'form', 'upload', 'laydate'], function () {
        var form = layui.form, laydate = layui.laydate, $ = layui.$, upload = layui.upload;
        $('.starttime').each(function () {
            laydate.render({
                elem: this
                , trigger: 'click'
            });
        });

        $("#layui-upload-list-id div").each(function () {
            var li_id = $(this).attr("id");

            layer.photos({
                photos: '#' + li_id
                , anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
            });
            // id = li_id.replace("li","");
        });

        //下载
        $('.dow').click(function () {
            var id = $(this).attr("id");
            layer.msg("开通中..." + id);
        });


        //上传
        $('#btn button').each(function () {
            var td_id = $(this).attr("id");
            var id = $(this).attr("name");
            var new_img_url_id = $(this).next('input').attr('id'); //找id
            var old_string = $('#' + new_img_url_id).val();
            if (old_string != "" && old_string == 'undefined') {
                var old_arr = old_string.split(',');
            }
            var new_arr = [];
            upload.render({
                elem: '#' + td_id
                , url: "{:url('query/upload')}" //改成您自己的上传接口
                , multiple: true
                , accept: 'images/*'
                , before: function (obj) {
                    //预读本地文件示例，不支持ie8
                    obj.preview(function (index, file, result) {
                        var html = '<img src="' + result + '" alt="' + file.name + '" class="layui-upload-img" style="width:40px;height:40px">';

                        // html+=' <input type="text" name="pic_img_name" class="layui-input pic_img_name" id="pic_img_name">';
                        $('#demo' + id).append(html);
                    });
                }
                , done: function (res) {
                    if (old_string != "" && old_string == 'undefined') {
                        old_arr.push(res.data.src);
                        $('#' + new_img_url_id).val(old_arr);
                    } else {
                        new_arr.push(res.data.src);
                        $('#' + new_img_url_id).val(new_arr);
                    }

                },
                allDone: function (obj) {
                    layer.msg("执行完毕，文件总数：" + obj.total + "成功：" + obj.successful + "个，失败：" + obj.aborted + "个");
                }
            });
        })

    });
</script>